﻿using System.Collections.Generic;

using EasyStep.Business.Interfaces;
using EasyStep.Business.Interfaces.Managers;
using EasyStep.Business.Interfaces.Providers;
using EasyStep.Business.Managers.FileSystem;
using EasyStep.Business.Providers;
using EasyStep.TestExecution.Interfaces;
using EasyStep.TestExecution.Manager;


namespace EasyStep.Business
{
    public class MainApplicationService
    {
        public static void Initialize(Dictionary<string,string> configuration)
        {
            ObjectManager.Initialize();

            ///register providers
            ObjectManager.RegisterInstance<ITestConstantsProvider>(() => new TestConstantsProvider());
            ObjectManager.RegisterInstance<ITestConstantsListProvider>(() => new TestConstantsListsProvider());
            ObjectManager.RegisterInstance<ITestProjectProvider>(() => new TestProjectProvider());
            ObjectManager.RegisterInstance<ITestStepProvider>(() => new TestStepProvider());
            ObjectManager.RegisterInstance<ITestInfoProvider>(() => new TestInfoProvider());

            //register managers
            ObjectManager.RegisterInstance<ITestActionManager, EasyStep.Business.Managers.TestActionManager>();
            ObjectManager.RegisterInstance<ITestUserManager, EasyStep.Business.Managers.TestUserManager>();

            ObjectManager.RegisterInstance<ITestConstantsListManager>(() => new EasyStep.Business.Managers.TestConstantsListManager(ObjectManager.GetInstance<ITestConstantsListProvider>()));
            ObjectManager.RegisterInstance<ITestProjectManager>(() => new EasyStep.Business.Managers.TestProjectManager(ObjectManager.GetInstance<ITestProjectProvider>()));
            
            ObjectManager.RegisterInstance<ITestConstantManager>(() => new TestConstManager(ObjectManager.GetInstance<ITestDataContext>()));
            ObjectManager.RegisterInstance<ITestStepManager>(() => new TestStepManager(ObjectManager.GetInstance<ITestDataContext>()));
            ObjectManager.RegisterInstance<ITestInfoManager>(() => new TestInfoManager(ObjectManager.GetInstance<ITestDataContext>()));
            ObjectManager.RegisterInstance<ITestHistoryManager>(() => new TestHistoryManager(ObjectManager.GetInstance<ITestDataContext>()));
            

           
        }
    }
}